﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace UniversityCourses.Extensions
{
    public static class BoxExtensions
    {
        //extension method, each box represents a course 
        public static System.Web.Mvc.MvcHtmlString CourseBox(this HtmlHelper htmlHelper, int id, string value)
        {
            string name = string.Format("cb{0}", id);
            TagBuilder tagBuilder = new TagBuilder("div");
            tagBuilder.Attributes.Add("name", name);
            tagBuilder.Attributes.Add("class", "course-box not-registered");
            tagBuilder.Attributes.Add("id", name);
            tagBuilder.InnerHtml = string.Format("<div class='title'>{0}</div><div class='del' title='delete'>&nbsp;</div><div class='registered'>registered</div><a class='edit' href='#'>edit</a>", value);
            return new MvcHtmlString(tagBuilder.ToString(TagRenderMode.Normal));
        }
    }
}